package com.cskaoyan.bean.vo;

import com.cskaoyan.bean.bo.AdminCreateBO;
import com.cskaoyan.bean.po.AdminPO;
import com.cskaoyan.util.StringToArrayUtils;
import lombok.Data;

import java.util.Date;
import java.util.List;
@Data
public class AdminCreateVO {
    Integer id; //id
    String username; //管理员名称
    String password; //管理员密码
    String avatar; //头像图片
    Date addTime; //创建时间
    Date updateTime; //更新时间
    List<Integer> roleIds;

    public AdminCreateVO getAdminCreateVO(AdminPO adminPO){
        AdminCreateVO adminCreateVO = new AdminCreateVO();
        adminCreateVO.setAddTime(adminPO.getAddTime());
        adminCreateVO.setAvatar(adminPO.getAvatar());
        adminCreateVO.setPassword(adminPO.getPassword());
        adminCreateVO.setId(adminPO.getId());
        adminCreateVO.setUsername(adminPO.getUsername());
        adminCreateVO.setUpdateTime(adminPO.getUpdateTime());
        adminCreateVO.setRoleIds(StringToArrayUtils.toArray(adminPO.getRoleIds()));
        return adminCreateVO;
    }

}
